#include "Scene06.hpp"

Scene06::Scene06() {
    b2Vec2 vertices[8];
    vertices[0].Set(-7.0f, -3.0f);
    vertices[1].Set(7.0f, -3.0f);
    vertices[2].Set(7.0f, 3.0f);
    vertices[3].Set(-7.0f, 3.0f);
    vertices[4].Set(-7.0f, 1.0f);
    vertices[5].Set(-5.0f, 1.0f);
    vertices[6].Set(-5.0f, -1.0f);
    vertices[7].Set(-7.0f, -1.0f);

    this->createRoom(6, vertices, 8);

    b2Vec2 platformVertices[2];
    platformVertices[0].Set(-5.0f, 1.0f);
    platformVertices[1].Set(2.0f, 1.0f);

    this->createPlatform(platformVertices, 2);

    this->start = this->createDoor(-5.0f, -2.0f, -1.0f);
    this->createExit(-6.0f, 2.0f)->setImpulseDirection(b2Vec2(-1.0f, 0.0f));
    this->hero = this->createHero(-7.0f + HeroElement::WIDTH / 2.0f, -3.0f + HeroElement::HEIGHT / 2.0f);

    SpotlightElement* light = this->createSpotlight(-4.65f, 0.0f, 0.0f, b2_pi / 6.0f, 12.0f, LightElement::repulsiveLight);
    light->setState(true);
    light->supportBarDirection->Set(-1.0f, 0.0f);

    // Box to open the exit.
    this->exit = this->createDoor(-5.0f, 2.0f, -1.0f);
    this->createSwitch(7.0f, 0.0f, b2_pi / 2.0f, this->exit);
    this->createBox(0.0f, -2.5f);
}
